<template>
    <hd-login :loginStyle="loginStyle" :fun="beforeLogin"></hd-login>
</template>

<script>
import { mapActions } from 'vuex'
import bg from '@/assets/images/loginBg.jpg'
export default {
  data () {
    return {
      loginStyle: {
        backgroundImage: 'url(' + bg + ')'
      }
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo'
    ]),
    async beforeLogin () {
      let rest = await this.getUserInfo()
      if (rest.errcode === 0) {
        return true
      } else {
        this.$Message.error('获取用户信息失败')
        return false
      }
    }
  }
}
</script>
<style  lang="less">
    .login{
        display: flex;
        justify-content: center;
        align-items: center;
        background-size: 100% 100% !important;
        .login-con{
            position: relative !important;
            left: 0;
            top: 0;
            transform: translateY(0);
        }
    }
</style>
